package com.lagou.work1;

import java.util.List;

public class StudentDel {

    public static boolean delStudent(int num, List<Student> list) throws StudentNumException {
        Student student = new Student();
        student.setNum(num);
        if (!list.contains(student)){
            System.out.println("学号为" + num + "的学生不存在");
            return false;
        }
        int i = list.indexOf(student);
        list.remove(i);
        System.out.println("删除学生成功");
        return true;
    }

}
